import createHeading from './index2.js'
import icon from '../public/test.jpg'
import '../index.html'
import './main.css'
import footer from './footer.html'


const heading = createHeading()
document.body.appendChild(heading)
const img = new Image()
img.src = icon
document.body.appendChild(img)

if (module.hot) {
    let lastCreate = heading
    module.hot.accept('./index2.js', () => {
        console.log('热更新了')

        const value = lastCreate.innerHTML

        document.body.removeChild(lastCreate)

        const newHeading = createHeading()
        newHeading.innerHTML = value
        document.body.appendChild(newHeading)
        lastCreate = heading
    })
    module.hot.accept('../public/test.jpg', () => {
        img.src = icon
        console.log('图片修改')
    })
}
